﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Management/ChargeNurse/ChargeNurse.master"
    AutoEventWireup="true" CodeFile="Benhnhan.aspx.cs" Inherits="Management_ChargeNurse_Benhnhan" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="../Thongtinbenhnhan.ascx" TagName="Thongtinbenhnhan" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <style type="text/css">
        .tbHeader
        {
            vertical-align: middle;
            text-align: left;
            border: 1px;
            height: 40px;
        }
        .tbCell
        {
            vertical-align: middle;
            text-align: left;
            height: 30px;
            border: 1px;
        }
        table.test
        {
            border: 1px solid #0000B0;
            border-collapse: collapse;
            padding: 5px;
        }
        .test td
        {
            padding: 5px;
            vertical-align: top;
        }
        .style6
        {
            width: 161px;
        }
    </style>
    <asp:Panel runat="server" Width="950px" Height="450px">
        <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="1" OnActiveTabChanged="tab_changed"
            Width="100%" Height="400px">
            <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Tìm theo phòng">
                <ContentTemplate>
                    <table class="test">
                        <tr>
                            <td>
                                <asp:Label ID="Label1c" runat="server" Text="Danh sách phòng"></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="lbDanhsachgiuong" runat="server" Width="250px"></asp:Label>
                            </td>
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Panel ID="Panel1" runat="server" Width="122px" Height="320px" ScrollBars="Vertical"
                                    Style="overflow: auto">
                                    <asp:GridView ID="GridView1" runat="server" Width="98px" DataSourceID="phongDS" AutoGenerateColumns="False"
                                        DataKeyNames="ID" ForeColor="#333333" GridLines="None">
                                        <AlternatingRowStyle BackColor="White" />
                                        <Columns>
                                            <asp:TemplateField HeaderText="Mã phòng" InsertVisible="False" SortExpression="ID">
                                                <ItemTemplate>
                                                    <asp:LinkButton ID="Label1d" runat="server" Text='<%# Eval("RoomName") %>' OnClick="danhsachgiuong_click"
                                                        CommandArgument='<%# Eval("ID") %>'></asp:LinkButton>
                                                </ItemTemplate>
                                                <HeaderStyle CssClass="tbHeader" />
                                                <ItemStyle CssClass="tbCell" />
                                            </asp:TemplateField>
                                        </Columns>
                                        <EditRowStyle BackColor="#2461BF" />
                                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                        <RowStyle BackColor="#EFF3FB" />
                                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                                    </asp:GridView>
                                    <asp:SqlDataSource ID="phongDS" runat="server" ConnectionString="<%$ ConnectionStrings:HOSPITALMANAGEMENTConnectionString %>"
                                        SelectCommand="SELECT [ID], [RoomName] FROM [tbRoom] WHERE ([IDWard] = @IDWard)">
                                        <SelectParameters>
                                            <asp:FormParameter FormField="IDWard" Name="IDWard" Type="Int32" />
                                        </SelectParameters>
                                    </asp:SqlDataSource>
                                </asp:Panel>
                            </td>
                            <td>
                                <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataKeyNames="BedName"
                                    DataSourceID="benhnhanDS" Width="257px" BackColor="White" BorderColor="#CCCCCC"
                                    BorderStyle="None" BorderWidth="1px" CellPadding="3" ShowHeaderWhenEmpty="True">
                                    <Columns>
                                        <asp:BoundField DataField="BedName" HeaderText="Mã giường" InsertVisible="False"
                                            ReadOnly="True" SortExpression="BedName">
                                            <HeaderStyle CssClass="tbHeader" />
                                            <ItemStyle CssClass="tbCell" />
                                        </asp:BoundField>
                                        <asp:TemplateField HeaderText="Bệnh nhân">
                                            <ItemTemplate>
                                                <asp:LinkButton ID="Label1e" runat="server" Text='<%# String.IsNullOrEmpty(Eval("FirstName").ToString())? "(trống)" : Eval("FirstName") + " " + Eval("LastName") %>'
                                                    OnClick="benhnhan_click" CommandArgument='<%# Eval("IDPatient") +"&" + Eval("IDAppointment") %>'></asp:LinkButton>
                                            </ItemTemplate>
                                            <HeaderStyle CssClass="tbHeader" />
                                            <ItemStyle CssClass="tbCell" />
                                        </asp:TemplateField>
                                    </Columns>
                                    <FooterStyle BackColor="White" ForeColor="#000066" />
                                    <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                                    <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                                    <RowStyle ForeColor="#000066" />
                                    <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                                    <SortedAscendingCellStyle BackColor="#F1F1F1" />
                                    <SortedAscendingHeaderStyle BackColor="#007DBB" />
                                    <SortedDescendingCellStyle BackColor="#CAC9C9" />
                                    <SortedDescendingHeaderStyle BackColor="#00547E" />
                                </asp:GridView>
                                <asp:SqlDataSource ID="benhnhanDS" runat="server" ConnectionString="<%$ ConnectionStrings:HOSPITALMANAGEMENTConnectionString %>"
                                    SelectCommand="SELECT tbBed.[BedName], tbImpatient.[IDPatient], tbPatient.FirstName, tbPatient.LastName, tbImpatient.[IDAppointment] FROM tbBed LEFT OUTER JOIN tbImpatient ON tbImpatient.[IDBed]=tbBed.[ID] LEFT OUTER JOIN tbPatient ON (tbImpatient.[IDPatient]=tbPatient.[ID] AND tbImpatient.[IDAppointment]=tbPatient.[LastAppointment] AND Status=0) LEFT OUTER JOIN tbRoom ON tbBed.[IDRoom]=tbRoom.[ID] WHERE(tbRoom.ID=@IDRoom)">
                                    <SelectParameters>
                                        <asp:FormParameter Name="IDRoom" FormField="IDRoom" Type="Int32" />
                                    </SelectParameters>
                                </asp:SqlDataSource>
                            </td>
                            <td>
                                <table>
                                    <tr>
                                        <td rowspan="2">
                                            <asp:Panel runat="server" ID="pnTT" Visible="False">
                                                <uc1:Thongtinbenhnhan ID="Thongtinbenhnhan1" runat="server" />
                                                <br />
                                                <asp:Button ID="btUpdateDrug" runat="server" OnClick="btUpdateDrug_Click" Text="Cập nhật đơn thuốc" />
                                                <asp:Button ID="btDone" runat="server" Text="Xuất viện" />
                                            </asp:Panel>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </cc1:TabPanel>
            <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="Hiển thị tất cả">
                <ContentTemplate>
                    <table width="100%" style="vertical-align: top">
                        <tr>
                            <td>
                                <asp:GridView ID="GridView3" runat="server" Width="410px" AutoGenerateColumns="False"
                                    DataSourceID="benhDS" Height="122px" CellPadding="4" ForeColor="#333333" 
                                    GridLines="None" ShowHeaderWhenEmpty="True">
                                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                    <Columns>
                                        <asp:TemplateField HeaderText="Tên bệnh nhân" SortExpression="IDPatient">                                            
                                            <ItemTemplate>
                                                <asp:Label ID="Label1a" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
                                            </ItemTemplate>
                                            <ItemStyle CssClass="tbCell" />
                                            <HeaderStyle CssClass="tbHeader" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Giường bệnh">                                            
                                            <ItemTemplate>
                                                <asp:Label ID="Label1b" runat="server" Text='<%# Bind("BedName") %>'></asp:Label>
                                            </ItemTemplate>
                                            <ItemStyle CssClass="tbCell" />
                                            <HeaderStyle CssClass="tbHeader" />
                                        </asp:TemplateField>
                                        <asp:TemplateField>                                           
                                            <ItemTemplate>
                                                <asp:LinkButton ID="Label2" runat="server" Text='Chi tiết' OnClick="benhnhan_click" CommandArgument='<%# Eval("IDPatient") +"&" + Eval("IDAppointment") %>'></asp:LinkButton>
                                            </ItemTemplate>
                                            <ItemStyle CssClass="tbCell" />
                                            <HeaderStyle CssClass="tbHeader" />
                                        </asp:TemplateField>
                                    </Columns>
                                    <EditRowStyle BackColor="#999999" />
                                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                    <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                    <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                    <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                                </asp:GridView>
                                <asp:SqlDataSource ID="benhDS" runat="server" ConnectionString="<%$ ConnectionStrings:HOSPITALMANAGEMENTConnectionString %>"
                                    SelectCommand="SELECT tbPatient.[FirstName] + ' ' + tbPatient.[LastName] as 'Name', tbBed.[BedName], IDPatient, IDAppointment FROM [tbImpatient] INNER JOIN tbBed ON tbImpatient.[IDBed]=tbBed.[ID] INNER JOIN tbPatient ON tbImpatient.[IDPatient]=tbPatient.[ID] WHERE Status=0 AND [IDWard] = @IDWard ORDER BY [DateInWard]">
                                    <SelectParameters>
                                        <asp:FormParameter FormField="IDWard" Name="IDWard" Type="Int32" />
                                    </SelectParameters>
                                </asp:SqlDataSource>
                            </td>
                            <td>
                                <uc1:Thongtinbenhnhan ID="Thongtinbenhnhan2" runat="server" />
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </cc1:TabPanel>
        </cc1:TabContainer>
    </asp:Panel>
</asp:Content>
